package com.superitem.school.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.superitem.school.mapper.GoodsMapper;
import com.superitem.school.pojo.Goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsService {
    @Autowired
    public GoodsMapper goodsMapper;

    public PageInfo<Goods> showAllGoods(Integer pageNum, Integer pageSize){
        PageHelper.startPage(pageNum, pageSize);
        List<Goods> goods = goodsMapper.getAllGoods();
        return new PageInfo<>(goods);

    }

    public Goods showOneGood(Integer id){
        Goods good = goodsMapper.getOneGood(id);
        return good;
    }
}
